using System.Collections.Generic;
using UnityEngine;

namespace Unity.Game.ElisAdvance.MonsterScript
{
    public class TestMonsterScript
    {

        private EnemyActiveObject obj;

        public TestMonsterScript(EnemyActiveObject active)
        {
            obj = active;
        }

        public void onInit()
        {
            obj.initActiveObjectAttackEvent();
            obj.setState(State.STATE_STAND);
            obj.getAttackInfo().setEnable(true, "PLAYER");
            obj.setTeam(Team.MONSTER);
            obj.setDirection(Direction.LEFT);

        }
        public void onSetState(State state)
        {
            if (state == State.STATE_ATTACK)
            {

            }
            else if (state == State.STATE_DAMAGE)
            {
                //obj.setShake(CameraShakeType.HORIZONTAL,1.0f, 0.2f);
            }
            else if (state == State.STATE_STAND)
            {
                obj.getAniManager().setAni("Stay");
            }
        }

        public void onDestroy()
        {
            Debug.Log("sendDestroy");
        }

        public void onBeforeDestroy()
        { 
        }

        public void onDamage(ActiveObject attacker, float damage, DamageBounsType type, params float[] vector)
        {
            //Debug.Log("hitCount");

        }

        // Update is called once per frame
        public void onProc()
        {

            if (Com.checkObjectTime(obj, "testTime", 0.5f))
            {
                obj.getAttackInfo().resetHitObjectList();
            }

            if (obj.getState() == State.STATE_DAMAGE)
            {
                if (obj.getStateTimer() < 0.5f)
                {
                    float rotate = Math2.getParabola(obj.getStateTimer(), 10.0f, 0.5f);
                    obj.setAngleRotate(rotate);
                }

            }
            else if (obj.getState() == State.STATE_ATTACK)
            {
                if (obj.getStateTimer() > 0.5f)
                {
                    obj.setState(State.STATE_STAND);
                }
            }

            AttackObjectTempVector hit = obj.getAttackInfo().onInAreaAttack(-0.25f, 0.0f, 0.5f, 2.0f);  
            hit.sendHit(obj, 1.0f, DamageBounsType.PUSH, 3.0f, 2.0f,0.5f);

        }

    }

}
